// components/detailList/detailList.js
const app = getApp()
Component({
  /**
   * 组件的属性列表
   */
  properties: {
    musiclist: Array
  },

  /**
   * 组件的初始数据
   */
  data: {
    playingId: ''
  },

  pageLifetimes: {
    show: function() {
      this.setData({
        playingId: app.getPlayingId()
      })
    }
  },
  /**
   * 组件的方法列表
   */
  methods: {
    goToPlayer(e) {
      const ds = e.currentTarget.dataset
      
      this.setData({
        playingId: ds.musicid
      })
      wx.navigateTo({
        url: `../../pages/player/player?musicId=${ds.musicid}&index=${ds.index}`
      })
      wx.setStorageSync('musicList', this.properties.musiclist)
    }
  }
})
